﻿@{;
ViewBag.Title = "表单页面";
Layout = "~/Views/Shared/_Form.cshtml";
}
<style type="text/css">
    #AuditStatus .active {
        color: rgb(255, 255, 255);
        background-color: rgb(40, 96, 144);
        border-color: rgb(32, 77, 116);
    }
</style>
<script>
    var keyValue = request('keyValue');
    $(function () {
        initControl();
    });

    //初始化控件
    function initControl() {
        //获取表单
        if (!!keyValue) {
            $.SetForm({
                url: "../../CustomerManage/TBOrder/GetFormJson",
                param: { keyValue: keyValue },
                success: function (data) {
                    $("#form1").SetWebControls(data);
                    //$("#AuditStatus a.btn-default").removeClass("active");
                    $("#AuditStatus a.btn-default").each(function () {
                        if ($(this).attr('data-value') == data["Status"]) {
                            $(this).addClass("active").siblings().removeClass("active");
                            $("#Status").val(data["Status"]);
                        }
                    });
                }
            });
        }
        //订单审核状态
        $("#AuditStatus a.btn-default").click(function () {
            $("#AuditStatus a.btn-default").removeClass("active");
            $(this).addClass("active");
            switch ($(this).attr('data-value')) {
                case "0": //待审核
                    $("#Status").val("0");
                    break;
                case "1": //审核通过
                    $("#Status").val("1");
                    break;
                case "2": //审核失败
                    $("#Status").val("2");
                    break;
                default:
                    break;
            }
        });
    }
    //保存表单;
    function AcceptClick() {
        if (!$('#form1').Validform()) {
            return false;
        }
        var postData = $("#form1").GetWebControls(keyValue);
        $.SaveForm({
            url: "../../CustomerManage/TBOrder/SaveForm?keyValue=" + keyValue,
            param: postData,
            loading: "正在保存数据...",
            success: function () {
                $.currentIframe().$("#gridTable").trigger("reloadGrid");
            }
        });
    }
</script>
<div style="margin-top: 20px; margin-right: 30px;">
    <table class="form">
        <tr>
            <td class="formTitle">客户编号</td>
            <td class="formValue">
                <input id="CustomerId" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" disabled="disabled" />
            </td>
        </tr>
        <tr>
            <td class="formTitle">订单编号</td>
            <td class="formValue">
                <input id="OrderId" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" disabled="disabled" />
            </td>
        </tr>
        <tr>
            <td class="formTitle">订单状态</td>
            <td class="formValue">
                <div id="AuditStatus" class="btn-group">
                    <a class="btn btn-default active" data-value="0">待审核</a>
                    <a class="btn btn-default" data-value="1">审核成功</a>
                    <a class="btn btn-default" data-value="2">审核失败</a>
                </div>
                <input id="Status" type="hidden" class="form-control" isvalid="yes" checkexpession="NotNull" value="0" />
            </td>
        </tr>
        <tr>
            <td class="formTitle">备注说明</td>
            <td class="formValue">
                <textarea id="Description" class="form-control" isvalid="no" checkexpession="NotNull" rows="3"></textarea>
            </td>
        </tr>

    </table>
</div>
